import request,{getDownloadUrl} from '@/utils/request';

export async function upload(file:File): Promise<any> {
  const formData=new FormData();
  formData.append('file',file);
  return request('/document/upload',{
    method:'POST',
    data:formData,
    requestType:'form'
  });
}

export function download(documentId:string|number):string{
  return getDownloadUrl(`/document/download?id=${documentId}`);
}

export default {
  upload,
  download,
}
